package com.mall.api.user;

import com.mall.api.user.dto.UserDTO;
import com.mall.api.user.fallback.UserFeignFallback;
import com.mall.common.result.Result;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

@FeignClient(name = "mall-user", path = "/user", fallback = UserFeignFallback.class)
public interface UserFeignClient {

    @GetMapping("/{id}")
    Result<UserDTO> getUserById(@PathVariable("id") Long id);

    @GetMapping("/username/{username}")
    Result<UserDTO> getUserByUsername(@PathVariable("username") String username);

    @PostMapping("/register")
    Result<Void> register(@RequestBody UserDTO userDTO);

    @PutMapping("/update")
    Result<Void> updateUser(@RequestBody UserDTO userDTO);

    @DeleteMapping("/{id}")
    Result<Void> deleteUser(@PathVariable("id") Long id);
} 